package com.duoketech.model.order;
import com.duoketech.model.AbstractModel;
import com.duoketech.model.product.Product;
import com.duoketech.utils.PageUtil;

public class Order extends AbstractModel<Order>{
    public static final Order dao = new Order();

    public static  final int STATUS_UNPAY=1;//待付款
    public static  final int STATUS_PAID=2;//已付款
    public static  final int STATUS_DELIVERY=3;//已发货
    public static  final int STATUS_CONFIRM=4;//已收货
    public static  final int STATUS_REFUND=5;//申请退货

    public static final int  DELIVERY_TYPE_SHUNFENG =1;//顺丰
    public static final int  DELIVERY_TYPE_YUANTONG =2;//圆通
    public static final int  DELIVERY_TYPE_ZHONGTONG =3;//中通
    public static final int  DELIVERY_TYPE_SHENGTONG =4;//申通
    public static final int  DELIVERY_TYPE_BAISHI =5;//百世快递


    public static final int ORDER_TYPE_ROOM=1;
    public static final int ORDER_TYPE_ACTIVITY=2;
    public static final int ORDER_TYPE_SHOPPING=3;
    public static final String ID = "id";//
    public static final String ORDER_SER = "order_ser";//订单商品ID
    public static final String OBJ_TYPE = "obj_type";//订单类型
    public static final String STATUS = "status";//订单状态
    public static final String CREATE_TIME = "create_time";//创建时间
    public static final String MODIFY_TIME = "modify_time";//修改时间
    public static final String TOTAL_FEE = "total_fee";//订单总价
    public static final String CREATE_BY = "create_by";//订单创建者
    public static final String UNIT_ID = "unit_id";//商家id
    public static final String MEMBER_ID = "member_id";//member_id
    public static final String OBJ_ID = "obj_id";//obj_id
    public static final String TOTAL_NUM = "total_num";//obj_id
    public static final String DELIVERY_FEE = "delivery_fee";//obj_id
    public static final String TOTAL_WEIGHT = "total_weight";//obj_id
    public static final String ADDRESS = "address";//obj_id
    public static final String NAME = "name";//obj_id
    public static final String MOBILE = "mobile";//obj_id
    public static final String DELIVERY_TYPE = "delivery_type";//obj_id




    @Override
    public String tableName() {

        return "t_order";
    }

    public String totalFee(){
        return PageUtil.fengToYuan(getInt(Order.TOTAL_FEE))+"";
    }

    public String totalFeeWithDelivery(){

        return PageUtil.fengToYuan(getInt(Order.TOTAL_FEE)+getInt(Order.DELIVERY_FEE))+"";
    }

    public String deliveryFee(){
        return PageUtil.fengToYuan(getInt(Order.DELIVERY_FEE))+"";
    }
    public String totalWeight(){
        return PageUtil.g2Kg(getInt(Order.TOTAL_WEIGHT))+"";
    }
    public String deliveryType(){
        String result="未知";
        if(getInt(DELIVERY_TYPE)==DELIVERY_TYPE_SHUNFENG){
            result="顺丰快递";
        }else if(getInt(DELIVERY_TYPE)== DELIVERY_TYPE_YUANTONG){
            result="圆通快递";
        }else if(getInt(DELIVERY_TYPE)== DELIVERY_TYPE_ZHONGTONG){
            result="中通快递";
        }else if(getInt(DELIVERY_TYPE)==  DELIVERY_TYPE_SHENGTONG){
            result="申通快递";
        }else if(getInt(DELIVERY_TYPE)==   DELIVERY_TYPE_BAISHI){
            result="百世快递";
        }
        return result;
    }
    @Override
    public String status() {
        String result="未知";
        if(getInt(STATUS)==STATUS_NORMAL){
            result="正常状态";
        }else if(getInt(STATUS)== STATUS_UNPAY){
            result="等待付款";
        }else if(getInt(STATUS)== STATUS_PAID){
            result="已付款";
        }else if(getInt(STATUS)== STATUS_DELIVERY){
            result="已经发货";
        }else if(getInt(STATUS)== STATUS_CONFIRM){
            result="已经收货";
        }else if(getInt(STATUS)== STATUS_REFUND){
            result="申请退货";
        }else if(getInt(STATUS)== STATUS_DEL){
            result="已删除";
        }
        return result;
    }
}